package com.yt.order.service;

import com.yt.order.models.vo.RepairOrderVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.yt.order.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yt.order.mapper.RepairOrderMapper;
import com.yt.order.models.service.IRepairOrderService;
import com.yt.order.models.bo.RepairOrderSaveBO;
import com.yt.order.models.dto.RepairOrderDTO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 维修订单详情控制器
 *
 * @author thekai
 * @Date 2025-10-30 09:30:13
 */
@DubboService
public class RepairOrderServiceImpl extends ServiceImpl<RepairOrderMapper, RepairOrderDTO> implements IRepairOrderService{

    @Resource
    private YmlConfig ymlConfig;
    @Resource
    private RepairOrderMapper repairOrderMapper;

    @Override
    public boolean add(RepairOrderSaveBO saveBO) {
        RepairOrderDTO dto = new RepairOrderDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }
    @Override
    public List<RepairOrderVO> query(){
        List<RepairOrderVO>repairOrderVOS=repairOrderMapper.query();
        return repairOrderVOS;
    }
}
